#include <stdio.h>
int main()
{
    int letters = 0;
    int spaces = 0;
    int digits = 0;
    int others = 0;
    char c = 0;
    printf("input string:\n");
    while ((c = getchar()) != '\n')
    {
        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'z'))
            letters++;
        else if (c == ' ')
            spaces++;
        else if (c >= '0' && c <= '9')
            digits++;
        else
            others++;
    }
    printf("letters=%d\ndigits=%d\nspaces=%d\nothers=%d\n", letters, digits, spaces, others);
    return 0;
}